package Reeks5.VanRansbeeck.Kevin.Model.States.Player;

import Reeks5.VanRansbeeck.Kevin.Model.States.Game.SpelStateContext;
import java.util.Observable;

public class PlayerStateContext extends Observable {
    //CONTEXT
    
    private PokerSpelerState status;
    // PlayerState per speler
    private SpelStateContext spelstate;
    // 1 SpelStatus voor alles
    private int value;
    
    public PlayerStateContext(SpelStateContext ss) {
        this.setSpelstate(ss);
        this.setStatus(new NewState());
        this.setValue(0);
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    public SpelStateContext getSpelstate() {
        return spelstate;
    }

    private void setSpelstate(SpelStateContext spelstate) {
        this.spelstate = spelstate;
        
    }
    
    public PokerSpelerState getStatus() {
        return status;
    }

    public void setStatus(PokerSpelerState status) {
        this.status = status;
        this.setChanged();
        this.notifyObservers();
    }
    public void setStatus(PokerSpelerState status, int value) {
        this.status = status;
        this.setValue(value);
    }
    
    public void fold() {
        this.getStatus().fold(this, this.getSpelstate());
    }
    public void raise(int value) {
        this.getStatus().raise(this, this.getSpelstate(), value);
    }
    public void call(int value) {
        this.getStatus().call(this, this.getSpelstate(), value);
    }
    public void allin(int value) {
        this.getStatus().allin(this, this.getSpelstate(), value);
    }
    public void check() {
        this.getStatus().check(this, this.getSpelstate());
    }
    public void reset() {
        this.getStatus().reset(this, this.getSpelstate());
    }
    public void bet(int value) {
        this.getStatus().bet(this, this.getSpelstate(), value);
    }
    
    public String toString() {
        String str = "";
        str += this.getStatus().getStatus();
        if(getValue() > 0)
            str += " (" + this.getValue() + ")";
        return str;
    }
    
}
